#pragma once
#ifndef __APPLICATION_H__
#define __APPLICATION_H__

#include "Utility.h"

#include "../util/PreDeclare.h"
#include "../util/D3DCommon.h"

namespace WindGE
{
	class WIND_CORE_API Application
	{
	public:
		Application();
		virtual ~Application();

		bool init(RenderDevicePtr renderDevice, HWND hwnd, float width, float height);
		void resize(float width, float height);
		void render();

		void start();
		void pause();
		void resume();

		inline const std::wstring& app_name() const { return app_name_;				}
		inline void set_frame_count(int frameCount) { frame_count_ = frameCount;	}

		inline float width()  const { return client_width_;  }
		inline float height() const { return client_height_; }
		
		void begin_scene(const XMVECTORF32& color);
		void begin_scene(const float* color);
		void end_scene(bool isFixedFps = false);

	protected:
		virtual bool on_init()		{ return true; }
		virtual void on_resize()	{ }
		virtual void on_update()	{ }
		virtual void on_draw()		{ }

	protected:
		std::wstring			app_name_;
		HWND					hwnd_;
		float					client_width_;
		float					client_height_;
		int						frame_count_;
		bool					is_paused_;

		RenderSwapChainPtr		swap_chain_;
		RenderDevicePtr			render_device_;
	};

}//end namespace WindGE

#endif // !__APPLICATION_H__
